package com.wuhainan.beelzebub.controller.system;

import com.wuhainan.beelzebub.entity.system.CategoryDetails;
import com.wuhainan.beelzebub.service.system.CategoryDetailsService;
import com.wuhainan.beelzebub.utils.PageInfo;
import com.wuhainan.beelzebub.utils.TableData;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <br>Created by 吴海南 on 2017-12-18.
 * <br>星期一 at 上午 10:11.
 */
@RestController
@RequestMapping("api")
public class CategoryDetailsController {
    @Resource
    private CategoryDetailsService categoryDetailsService;
    @RequestMapping("categoryDetailsPage")
    public TableData CategoryDetailsPage(PageInfo pageInfo, CategoryDetails categoryDetails){
        return categoryDetailsService.findCategoryDetailsPage(pageInfo,categoryDetails);
    }
    @RequestMapping("categoryDetails/{id}")
    public CategoryDetails categoryDetails(@PathVariable String id) {
        return categoryDetailsService.findCategoryDetailsById(id);
    }

    @RequestMapping("saveCategoryDetails")
    public void saveCategoryDetails(@RequestBody CategoryDetails categoryDetails) {
        categoryDetailsService.saveCategoryDetails(categoryDetails);
    }

    @RequestMapping("deleteCategoryDetails")
    public void deleteCategoryDetails(@RequestBody CategoryDetails categoryDetails) {
        categoryDetailsService.deleteCategoryDetails(categoryDetails);
    }

}
